package com.cswangdao.controller.user;

import com.cswangdao.domain.po.Storage;
import com.cswangdao.result.Result;
import com.cswangdao.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/wx/storage")
@Slf4j
public class WxStorageController {

    @Autowired
    private StorageService storageService;


    @PostMapping("/upload")
    public Result<Storage> upload(MultipartFile file) throws IOException {
        log.info("图片上传");
        Storage upload = storageService.upload(file);
        return Result.success(upload);
    }

}
